package ufmg.arcabouco.ga;

import java.util.List;

/**
 * @author ramon
 * 
 */
public abstract class IndividuoGA implements Comparable<IndividuoGA> {

	protected double genome[];
	protected double fitness;

	public IndividuoGA(double[] ds) {
		this.genome = ds;
	}

	public double[] getGenome() {
		return genome;
	}

	public double getFitness() {
		return fitness;
	}

	public void setFitness(double fitness) {
		this.fitness = fitness;
	}

	public abstract void mutacao();

	public abstract List<IndividuoGA> crossOver(IndividuoGA mother);

	@Override
	public int compareTo(IndividuoGA ind) {
		if (this.fitness == ind.getFitness()) {
			return 0;
		} else if (this.fitness < ind.getFitness()) {
			return 1;
		} else {
			return -1;
		}
	}

}
